package com.ruoyi.web.controller.warehouse;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.warehouse.domain.LwWarehousinginfo;
import com.ruoyi.warehouse.service.ILwWarehousinginfoService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 仓库记录信息Controller
 * 
 * @author sll
 * @date 2023-10-13
 */
@RestController
@RequestMapping("/warehousinginfo/warehousinginfo")
public class LwWarehousinginfoController extends BaseController
{
    @Autowired
    private ILwWarehousinginfoService lwWarehousinginfoService;

    /**
     * 查询仓库记录信息列表
     */
    @PreAuthorize("@ss.hasPermi('warehouse:warehousinginfo:list')")
    @GetMapping("/list")
    public TableDataInfo list(LwWarehousinginfo lwWarehousinginfo)
    {
        startPage();
        List<LwWarehousinginfo> list = lwWarehousinginfoService.selectLwWarehousinginfoList(lwWarehousinginfo);
        return getDataTable(list);
    }

    /**
     * 导出仓库记录信息列表
     */
    @PreAuthorize("@ss.hasPermi('warehousinginfo:warehousinginfo:export')")
    @Log(title = "仓库记录信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, LwWarehousinginfo lwWarehousinginfo)
    {
        List<LwWarehousinginfo> list = lwWarehousinginfoService.selectLwWarehousinginfoList(lwWarehousinginfo);
        ExcelUtil<LwWarehousinginfo> util = new ExcelUtil<LwWarehousinginfo>(LwWarehousinginfo.class);
        util.exportExcel(response, list, "仓库记录信息数据");
    }

    /**
     * 获取仓库记录信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('warehousinginfo:warehousinginfo:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(lwWarehousinginfoService.selectLwWarehousinginfoById(id));
    }

    /**
     * 新增仓库记录信息
     */
    @PreAuthorize("@ss.hasPermi('warehousinginfo:warehousinginfo:add')")
    @Log(title = "仓库记录信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody LwWarehousinginfo lwWarehousinginfo)
    {
        return toAjax(lwWarehousinginfoService.insertLwWarehousinginfo(lwWarehousinginfo));
    }

    /**
     * 修改仓库记录信息
     */
    @PreAuthorize("@ss.hasPermi('warehousinginfo:warehousinginfo:edit')")
    @Log(title = "仓库记录信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody LwWarehousinginfo lwWarehousinginfo)
    {
        return toAjax(lwWarehousinginfoService.updateLwWarehousinginfo(lwWarehousinginfo));
    }

    /**
     * 删除仓库记录信息
     */
    @PreAuthorize("@ss.hasPermi('warehousinginfo:warehousinginfo:remove')")
    @Log(title = "仓库记录信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(lwWarehousinginfoService.deleteLwWarehousinginfoByIds(ids));
    }
}
